#ifndef __ANIMATION_HELPER_H__
#define __ANIMATION_HELPER_H__

#include "cocos2d.h"
#include "audio/include/AudioEngine.h"

#include "manager/GlobalData.h"
#include "AnimationUnit.h"
#include "LogicalSequence.h"

using namespace cocos2d;
using namespace cocos2d::ui;
using namespace cocostudio::timeline;
using namespace experimental;
using namespace std;

typedef map<string, LogicalSequence*> MapOfpLogicalSequence;

class AnimationHelper
{
public:

	static AnimationHelper* getInstance();

	bool play(Node* pNode, const char* logicalSequenceName);
	void pause();
	void stop();

	bool addLogicalSequence(string name, LogicalSequence* pLogicalSequence);

private:
	AnimationHelper();
	~AnimationHelper();

	LogicalSequence* getLogicalSequence(string name);
	AnimationUnit* getCurrentPlayUnit();

	void playSounds(list<list<string>> soundsList);

	//AnimationUnit Bulid
	void AnimationUnitStep(AnimationUnit* pAnimationUnit);

	void childCellOrSoundStepEnd(const char * fromFunction);

private:
	MapOfpLogicalSequence* m_pMapOfpLogicalSequence;
	LogicalSequence* m_pLogicalSequence;
	AnimationUnit* m_pCurrentAnimationUnit;
	list<ActionTimeline*> m_currentActions;

	CCNode* m_pCurrentNode;

	bool m_isSoundEnd;
	int m_cellNeedBackCount;

	
};
#endif //__ANIMATION_HELPER_H__